import request from "@/utils/request";

// 查询用户列表
export function listUser(query) {
  return request({
    url: "/user/list",
    method: "get",
    params: query,
  });
}

// 查询特定角色
export function getUserInfo(userId) {
  return request({
    url: "/user/info?userId=" + userId,
    method: "get",
  });
}

// 更新用户信息
export function updateUser(data) {
  return request({
    url: "/user/update",
    method: "post",
    data: data,
  });
}

// 新增用户
export function addUser(data) {
  return request({
    url: "/user/add",
    method: "post",
    data: data,
  });
}

// 删除用户
export function delUser(userId) {
  return request({
    url: "/user/del?userId=" + userId,
    method: "get",
  });
}

// 重置用户密码
export function resetPwd(userId) {
  return request({
    url: "/user/resetPwd?userId=" + userId,
    method: "get",
  });
}

// 用户状态切换
export function changeUserState(userId, state) {
  return request({
    url: "/user/changeState?userId=" + userId + "&state=" + state,
    method: "get",
  });
}

// 查询部门列表
export function listDept() {
  return request({
    url: "/dept/list",
    method: "get",
  });
}

// 更新部门信息
export function updateDept(data) {
  return request({
    url: "/dept/update",
    method: "post",
    data: data,
  });
}

// 新增用户
export function addDept(data) {
  return request({
    url: "/dept/add",
    method: "post",
    data: data,
  });
}

// 删除部门
export function delDept(deptId) {
  return request({
    url: "/dept/del?deptId=" + deptId,
    method: "get",
  });
}

// 查询特定部门
export function getDeptInfo(deptId) {
  return request({
    url: "/dept/info?deptId=" + deptId,
    method: "get",
  });
}

// 部门状态切换
export function changeDeptState(deptId, state) {
  return request({
    url: "/dept/changeState?id=" + deptId + "&state=" + state,
    method: "get",
  });
}

// 查询患者列表
export function listPatient(query) {
  return request({
    url: "/patient/list",
    method: "get",
    params: query,
  });
}

// 查询患者列表
export function getPatientNames(query) {
  return request({
    url: "/patient/names",
    method: "get",
    params: query,
  });
}


// 更新患者信息
export function updatePatient(data) {
  return request({
    url: "/patient/update",
    method: "post",
    data: data,
  });
}

// 新增患者
export function addPatient(data) {
  return request({
    url: "/patient/add",
    method: "post",
    data: data,
  });
}

// 删除患者
export function delPatient(patientId) {
  return request({
    url: "/patient/del?patientId=" + patientId,
    method: "get",
  });
}

// 查询特定患者
export function getPatientInfo(patientId) {
  return request({
    url: "/patient/info?patientId=" + patientId,
    method: "get",
  });
}

// 查询患者列表
export function listRecord(query) {
  return request({
    url: "/record/list",
    method: "get",
    params: query,
  });
}

// 更新记录信息
export function updateRecord(data) {
  return request({
    url: "/record/update",
    method: "post",
    data: data,
  });
}

// 新增记录
export function addRecord(data) {
  return request({
    url: "/record/add",
    method: "post",
    data: data,
  });
}

// 删除记录
export function delRecord(recordId) {
  return request({
    url: "/record/del?recordId=" + recordId,
    method: "get",
  });
}

// 查询特定记录
export function getRecordInfo(recordId) {
  return request({
    url: "/record/info?recordId=" + recordId,
    method: "get",
  });
}

// 查询转介申请单列表
export function listRefers(query) {
  return request({
    url: "/refer/list",
    method: "get",
    params: query,
  });
}
// 查询特定转介申请单
export function getReferInfo(referId) {
  return request({
    url: "/refer/info?referId=" + referId,
    method: "get",
  });
}

// 删除转介申请单
export function delRefer(referId) {
  return request({
    url: "/refer/del?referId=" + referId,
    method: "get",
  });
}

// 更新转介申请单
export function updateRefer(data) {
  return request({
    url: "/refer/update",
    method: "post",
    data: data,
  });
}

// 新增转介申请单
export function addRefer(data) {
  return request({
    url: "/refer/add",
    method: "post",
    data: data,
  });
}

// 查询转介申请单是否有引用
export function checkTodoRefer(deptId) {
  return request({
    url: "/refer/todo?deptId=" + deptId,
    method: "get",
  });
}

export function confirmRefer(referId) {
  return request({
    url: "/refer/confirm?referId=" + referId,
    method: "get",
  });
}


